package cn.com.ksplatform.base.page;

import java.util.Collection;

@SuppressWarnings("rawtypes")
public class PageInfoModel {

	private int page = 1;
	private int pageSize = 15;
	private String sortName;
	private String sortOrder;
	private int total;
	private Collection rows;
	private int totalPage;
	private int starIndex = 0;
	private int endIndex;

	public int getPage() {
		return this.page;
	}

	public void setPage(int page) {
		this.page = page;
	}

	public int getPageSize() {
		return this.pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public String getSortName() {
		return this.sortName;
	}

	public void setSortName(String sortName) {
		this.sortName = sortName;
	}

	public String getSortOrder() {
		return this.sortOrder;
	}

	public void setSortOrder(String sortOrder) {
		this.sortOrder = sortOrder;
	}

	public int getTotal() {
		return this.total;
	}

	public void setTotal(int total) {
		this.total = total;
	}

	public Collection getRows() {
		return this.rows;
	}

	public void setRows(Collection rows) {
		this.rows = rows;
	}

	public int getTotalPage() {
		this.totalPage = ((this.total + this.pageSize - 1) / this.pageSize);
		return this.totalPage;
	}

	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}

	public int getStarIndex() {
		this.starIndex = ((getPage() - 1) * getPageSize());
		return this.starIndex;
	}

	public void setStarIndex(int starIndex) {
		this.starIndex = starIndex;
	}

	public int getEndIndex() {
		this.endIndex = (getStarIndex() + getPageSize());
		return this.endIndex;
	}

	public void setEndIndex(int endIndex) {
		this.endIndex = endIndex;
	}

	public PageInfoModel(int page, int pageSize, String sortName, String sortOrder) {
		this.page = page;
		this.pageSize = pageSize;
		this.sortName = sortName;
		this.sortOrder = sortOrder;
	}

	public PageInfoModel() {
	}
}
